<template>
  <div class="product">
    <van-tabs v-model="active" sticky swipeable>
        <!-- 箭头 -->
        <img @click="onClickLeft" style="position: absolute;left: 13px;top: 12px;z-index: 999;width: 20px;height: 20px;" src="../../../src/assets/images/icon-arrow-right.png" alt>
      <van-tab>
        <div slot="title">
          <div class="tabs">
            <div style class="tabs-item">持有中</div>
          </div>
        </div>
        <div class="content">
          <!-- 图片 -->
          <div id="images">
            <van-row type="flex" justify="center">
              <van-col span="8">在投资产（BTC）</van-col>
              <van-col span="8" offset="4">
                <button>BTC估值</button>
              </van-col>
            </van-row>
            <van-row>
              <van-col span="6" style="margin-top:-20px;">0</van-col>
            </van-row>
          </div>
          <!-- 待收收益 -->
          <div class="shouyi">
            <van-row>
              <van-col span="6" style>待收收益</van-col>
            </van-row>
          </div>
          <div class="xian"></div>

          <div class="bi">
            <van-row>
              <!-- BTC -->
              <van-col span="6" style>
                <img src="../../../src/assets/images/icon-btc@2x.png" alt>
                <span>BTC</span>
                <li>{{totalIncomeAndWaitIncome.waitIncome}}</li>
              </van-col>
              <!-- ETH -->
              <van-col span="12" style>
                <img src="../../../src/assets/images/icon-eth@2x.png" alt>
                <span>ETH</span>
                <li>{{totalIncomeAndWaitIncome.waitIncome}}</li>
              </van-col>
            </van-row>

            <van-row>
              <!-- USDT -->
              <van-col span="6" style>
                <img src="../../../src/assets/images/icon-usdt@2x.png" alt>
                <span>USDT</span>
                <li>{{totalIncomeAndWaitIncome.waitIncome}}</li>
              </van-col>
              <!-- EOS -->
              <van-col span="12" style>
                <img src="../../../src/assets/images/icon-eos@2x.png" alt>
                <span>EOS</span>
                <li>{{totalIncomeAndWaitIncome.waitIncome}}</li>
              </van-col>
            </van-row>
          </div>
          <div style="height:8px;" class="xian"></div>
          <!-- 暂无相关记录 -->
          <div v-show="dataList.length==0">
            <img
              style="width:50px;height：50px;margin-top:110px"
              src="../../../src/assets/images/icon-record-gray@2x.png"
              alt
            >
            <li
              style="font-size:14px;font-family:PingFang-SC-Regular;font-weight:400;color:rgba(102,102,102,1);"
            >暂无相关记录</li>
            <button style="margin-top:15px;">浏览产品</button>
          </div>

          <!-- 记录 -->
          <div v-show="dataList.length!=0">
            <!-- 已购产品 -->
            <div class="shouyi">
              <van-row>
                <van-col span="6" style>已购产品</van-col>
              </van-row>
            </div>
            <div class="xian"></div>

            <!-- 列表循环 -->
            <div class="tabs-list">
              <ul>
                <li v-for="item in 3" :key="item.index">
                  <router-link :to="{name: 'planDetails'}" tag="li" class="list-item">
                    <div class="item-title">BTC7日抢先计划二十五期</div>
                    <div class="flex item-box">
                      <div class="item-l">
                        <div class="num-big">
                          6%
                          <span>%</span>
                        </div>
                        <div class="word">预期年化利率</div>
                      </div>
                      <div class="item-r">
                        <div class="num-big">
                          7
                          <span>天</span>
                        </div>
                        <div class="word">已购：1.000219BTC</div>
                      </div>
                    </div>
                  </router-link>
                </li>
              </ul>
            </div>
          </div>
        </div>
      </van-tab>

      <!-- 已结束 -->
      <van-tab>
        <div slot="title">
          <div class="tabs">
            <div style class="tabs-item">已结束</div>
          </div>
        </div>
        <div class="content">
          <!-- 待收收益 -->
          <div class="shouyi">
            <van-row>
              <van-col span="6" style>待收收益</van-col>
            </van-row>
          </div>
          <div class="xian"></div>

          <div class="bi">
            <van-row>
              <!-- BTC -->
              <van-col span="6" style>
                <img src="../../../src/assets/images/icon-btc@2x.png" alt>
                <span>BTC</span>
                <li>{{totalIncomeAndWaitIncome.grandTotalIncome}}</li>
              </van-col>
              <!-- ETH -->
              <van-col span="12" style>
                <img src="../../../src/assets/images/icon-eth@2x.png" alt>
                <span>ETH</span>
                <li>{{totalIncomeAndWaitIncome.grandTotalIncome}}</li>
              </van-col>
            </van-row>

            <van-row>
              <!-- USDT -->
              <van-col span="6" style>
                <img src="../../../src/assets/images/icon-usdt@2x.png" alt>
                <span>USDT</span>
               <li>{{totalIncomeAndWaitIncome.grandTotalIncome}}</li>
              </van-col>
              <!-- EOS -->
              <van-col span="12" style>
                <img src="../../../src/assets/images/icon-eos@2x.png" alt>
                <span>EOS</span>
                 <li>{{totalIncomeAndWaitIncome.grandTotalIncome}}</li>
              </van-col>
            </van-row>
          </div>
          <div style="height:8px;" class="xian"></div>
          <!-- 暂无相关记录 -->
          <div v-show="dataList.length==0">
            <img
              style="width:50px;height：50px;margin-top:110px"
              src="../../../src/assets/images/icon-record-gray@2x.png"
              alt
            >
            <li
              style="font-size:14px;font-family:PingFang-SC-Regular;font-weight:400;color:rgba(102,102,102,1);"
            >暂无相关记录</li>
            <button style="margin-top:15px;">浏览产品</button>
          </div>

          <!-- 记录 -->
          <div v-show="dataList.length!=0">
            <!-- 已购产品 -->
            <div class="shouyi">
              <van-row>
                <van-col span="6" style>已购产品</van-col>
              </van-row>
            </div>
            <div class="xian"></div>

            <!-- 列表循环 -->
            <div class="tabs-list">
              <ul>
                <li v-for="i in 3" :key="i.index">
                  <router-link :to="{name: 'planDetails'}" tag="li" class="list-item">
                    <div class="item-title">BTC7日抢先计划二十五期</div>
                    <div class="flex item-box">
                      <div class="item-l">
                        <div class="num-big">
                          6%
                          <span>%</span>
                        </div>
                        <div class="word">预期年化利率</div>
                      </div>
                      <div class="item-r">
                        <div class="num-big">
                          7
                          <span>天</span>
                        </div>
                        <div style="margin-left: -70px;" class="word">已购：1.000219BTC 收益：0.000219BTC</div>
                      </div>
                    </div>
                  </router-link>
                </li>
              </ul>
            </div>
          </div>
        </div>
      </van-tab>
    </van-tabs>
  </div>
</template>
<script>
import Vue from "vue";
import axios from "axios";
import { NavBar, Tab, Tabs, Row, Col } from "vant";
import { totalIncomeAndWaitIncome } from "../../axios/api.js";
export default {
  components: {
    [NavBar.name]: NavBar,
    [Tab.name]: Tab,
    [Tabs.name]: Tabs,
    [Row.name]: Row,
    [Col.name]: Col
  },
  data() {
    return {
      active:"",
      totalIncomeAndWaitIncome:[],
      dataList: [],
      data:{
         token: window.sessionStorage["token"],
      }
    };
  },
  methods: {
    //返回上一页
    onClickLeft() {
      this.$router.push("/mine");
    },

  
  },
   created() {
        totalIncomeAndWaitIncome({
            params: this.data
        }).then(res => {
            console.log(res.data.data)
            this.totalIncomeAndWaitIncome = res.data.data;
        });
       
    }
};
</script>
<style lang="less" scoped>
@import "../../assets/less/variable.less";
/deep/.van-tab {
  color: @base_textColor;
}
/deep/ .van-tabs__line {
  background-color: #ffffff;
}
/deep/ .van-tab--active {
  color: #D1A568;
}
/deep/ .van-tabs__wrap {
  position: relative;
}
/deep/ .van-hairline--bottom::after {
  border-bottom-width: 0;
}
/deep/ .van-hairline--top-bottom::after {
  border-width: 0;
}
/deep/ .van-tabs--line {
  padding-top: 0;
}
/deep/ .tabs-item {
  font-size: 18px;
  font-family: PingFang-SC-Medium;
  font-weight: 500;
}
.product {
  height: 100%;
  background: #ffffff;
  overflow: hidden;
  position: relative;

  #images {
    width: 100%;
    height: 100px;
    background: url(../../../src/assets/images/card-background.png);
    background-size: 100%;
  }
  #images .van-row {
    font-size: 0.4rem;
    font-family: PingFang-SC-Medium;
    font-weight: 500;
    color: rgba(255, 255, 255, 1);
    padding-top: 30px;
  }
  button {
    border: 1px solid #d1a568;
    background: none;
    width: 100px;
    height: 30px;
    border-radius: 20px;
    font-size: 0.4rem;
    font-family: PingFang-SC-Medium;
    font-weight: 500;
    color: rgba(209, 165, 104, 1);
    // margin-left: 100px;
  }
  //   收益
  .shouyi .van-row {
    font-size: 0.4rem;
    font-family: PingFang-SC-Medium;
    font-weight: 500;
    color: rgba(51, 51, 51, 1);
    margin-top: 17px;
  }
  .xian {
    width: 100%;
    height: 1px;
    background: rgba(239, 239, 239, 1);
    margin-top: 17px;
  }
  .bi .van-row img {
    width: 25px;
    height: 25px;
    padding-top: 15px;
  }
  .bi .van-row span {
    font-size: 14px;
    font-family: PingFang-SC-Regular;
    font-weight: 400;
    color: rgba(102, 102, 102, 1);
    position: absolute;
    margin-top: 10px;
    margin-left: 6px;
  }
  .bi .van-row li {
    font-size: 14px;
    font-family: PingFang-SC-Medium;
    font-weight: 500;
    color: rgba(51, 51, 51, 1);
    margin-left: 40px;
    margin-top: -10px;
  }

  // 定期分币计划
  .tabs-list {
    margin-top: 10px;
    .list-title {
      text-align: left;
      font-size: @base_textSize;
      font-weight: bold;
      color: @base_textColor;
      border-bottom: @base_boder;
      background: @base_background;
      padding: 10px;
    }
    .list-item:last-child {
      border-bottom: none;
    }
    .list-item {
      padding-left: 10px;
      background: @base_background;
      border-bottom: @base_boder;
      .item-title {
        text-align: left;
        padding: 10px;
        font-size: @base_textSize;
        color: @base_textColor;
      }
      .item-box {
        padding-bottom: 10px;
        .item-l {
          width: 50%;
          text-align: left;
          padding-left: 25px;
          .num-big {
            font-size: 2em;
            color: #D1A568;
            span {
              font-size: 0.6em;
            }
          }
          .word {
            margin-top: 5px;
            color: #969799f5;
          }
        }
        .item-r {
          width: 50%;
          text-align: left;
          padding-left: 25px;
          .num-big {
            font-size: 2em;
            color: @base_textColor;
            span {
              font-size: 0.6em;
            }
          }
          .word {
            margin-top: 5px;
            color: #333333;
          }
        }
      }
    }
  }
}
</style>
